Skip to content

Enable the 'selfbot' button#42

Open
Zoidwaffle wants to merge 1 commit into
Wishmaster117:mainfrom
Zoidwaffle:multibot_button
Open

Enable the 'selfbot' button#42
Zoidwaffle wants to merge 1 commit into
Wishmaster117:mainfrom
Zoidwaffle:multibot_button

Conversation

@Zoidwaffle

@Zoidwaffle Zoidwaffle commented Jul 9, 2026

Copy link
Copy Markdown

Authored by: @Sakhwoow

Closes #33

Summary by CodeRabbit

  • New Features
    • Added a direct action for the self bot button to trigger a self-bot chat command and immediately update the on/off state.
  • Bug Fixes
    • Improved self button behavior so it now works consistently even when the disable control is unavailable, while still disabling it when supported.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The selfButton initialization in MultiBot.SyncBridgeRosterToPlayers is modified to add a doLeft handler that sends the ".playerbot bot self" chat command and calls MultiBot.OnOffSwitch, while the setDisable call condition is restructured.

Changes

Selfbot Button Fix

Layer / File(s) Summary
Add click handler for selfbot toggle
Core/MultiBot.lua
selfButton now defines a doLeft handler that issues the ".playerbot bot self" command and invokes MultiBot.OnOffSwitch(pButton); the conditional wrapping setDisable is restructured to check selfButton existence first, then optionally call setDisable().

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately describes the main change to the Selfbot button.
Linked Issues check ✅ Passed The change directly addresses #33 by wiring the Selfbot button to run the self command from the menu.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to the Selfbot button behavior and does not introduce unrelated updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Zoidwaffle

Copy link
Copy Markdown
Author

I 100% lifted the code from the comment in the issue thread - I cannot take any credit for the fix.

I simply made the PR, thanks a lot to @Sakhwoow for providing the info used.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Core/MultiBot.lua`:
- Around line 1432-1438: The self button handling in MultiBot.OnOffSwitch is not
synced to the actual selfbot active state, so it can be disabled even when the
selfbot is already active. Update the selfButton setup to use the same state
source as the roster buttons (the active-state check used by
SyncBridgeRosterToPlayers and IsBridgeRosterBotActive), and switch between
setEnable() and setDisable() accordingly before assigning doLeft. This keeps the
self button UI aligned with the current selfbot state and prevents the toggle
behavior from flipping the wrong way.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3d464879-da8d-4593-afca-7e12b199ee4e

📥 Commits

Reviewing files that changed from the base of the PR and between ef341a4 and a5a9501.

📒 Files selected for processing (1)
  • Core/MultiBot.lua

Comment thread Core/MultiBot.lua
Comment on lines +1432 to 1438
if selfButton then
if selfButton.setDisable then selfButton.setDisable() end
selfButton.doLeft = function(pButton)
SendChatMessage(".playerbot bot self", "SAY")
MultiBot.OnOffSwitch(pButton)
end
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check call sites of SyncBridgeRosterToPlayers
rg -n 'SyncBridgeRosterToPlayers' --type lua -g '!**/test/**'

# Check if selfbot active state is tracked in bridge roster or elsewhere
rg -n 'IsBridgeRosterBotActive\|SelfBot\|selfBot\|self_bot' --type lua -C3

Repository: Wishmaster117/MultiBot-Chatless

Length of output: 169


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the relevant file and nearby symbols.
git ls-files 'Core/MultiBot.lua'
wc -l Core/MultiBot.lua
rg -n 'SyncBridgeRosterToPlayers|OnOffSwitch|IsBridgeRosterBotActive|setDisable|setEnable|doLeft' Core/MultiBot.lua -n -C 4

# Inspect the function body around the cited lines.
sed -n '1408,1485p' Core/MultiBot.lua

# Find any bridge roster/selfbot state tracking elsewhere in the repo.
rg -n 'IsBridgeRosterBotActive|SyncBridgeRosterToPlayers|selfbot|self bot|selfBot|self_bot|bridge roster|bot self' .

Repository: Wishmaster117/MultiBot-Chatless

Length of output: 9383


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the active-state helper and self-button construction.
sed -n '1288,1375p' Core/MultiBot.lua
sed -n '1510,1615p' Core/MultiBot.lua
sed -n '1760,1845p' Core/MultiBot.lua

# Show the specific toggle handler used by the self button.
rg -n 'function MultiBot\.OnOffSwitch|OnOffSwitch\s*=' Core/MultiBot.lua Core/MultiBotHandler.lua Core/MultiBotEngine.lua -n -C 6

Repository: Wishmaster117/MultiBot-Chatless

Length of output: 8299


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the self-button constructor and any state initialization it performs.
rg -n 'function MultiBot\.addSelf|addSelf\s*=' Core/MultiBot.lua Core/MultiBotEngine.lua -n -C 8
sed -n '1980,2085p' Core/MultiBotEngine.lua

# Re-read the toggle helper for exact state behavior.
sed -n '834,845p' Core/MultiBotEngine.lua

Repository: Wishmaster117/MultiBot-Chatless

Length of output: 5278


Sync the self button with the current selfbot state. SyncBridgeRosterToPlayers always calls setDisable() for selfButton, while the roster buttons mirror IsBridgeRosterBotActive(...). If the selfbot is already active, the button still renders disabled and a click can toggle the command while the UI flips the wrong way. Use the same active-state source here and call setEnable()/setDisable() accordingly.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Core/MultiBot.lua` around lines 1432 - 1438, The self button handling in
MultiBot.OnOffSwitch is not synced to the actual selfbot active state, so it can
be disabled even when the selfbot is already active. Update the selfButton setup
to use the same state source as the roster buttons (the active-state check used
by SyncBridgeRosterToPlayers and IsBridgeRosterBotActive), and switch between
setEnable() and setDisable() accordingly before assigning doLeft. This keeps the
self button UI aligned with the current selfbot state and prevents the toggle
behavior from flipping the wrong way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue] Selfbot icon cant be clicked

1 participant